<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>node对象</title>
		<style type="text/css">
			div{
				border: 1px solid red;
			}
			#div1{
				width: 200px;
				height: 200px;
			}
			#div2{
				width: 100px;
				height: 100px;
			}
			#div3{
				width: 100px;
				height: 100px;
			}
		</style>
	</head>
	<body>
		<div id="div1">
			<div id="div2">div2</div>
			 div1
		</div>
		
		<a href="javascript:void(0);" id="ea">点我删除</a>
		<a href="javascript:void(0);" id="iea">点我添加</a>
		
		<script type="text/javascript">
			
			var e_a = document.getElementById("ea");
			var iea = document.getElementById("iea");
			e_a.onclick = function(){
				var div1 = document.getElementById("div1");
				var div2 = document.getElementById("div2");
				div1.removeChild(div2);
			}
			iea.onclick=function(){
				var div1 = document.getElementById("div1");
				var div3 = document.createElement("div");
				div3.setAttribute("id","div3");
			/*	div3.setAttribute("width","100px");
				div3.setAttribute("heigth","100px");*/
				div1.appendChild(div3);
			}
		</script>
	</body>
</html>
